package be.ipl.diapero.testUcc;

import static org.junit.Assert.*;

import java.util.GregorianCalendar;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.junit.Before;
import org.junit.Test;

import be.ipl.diapero.dao.TourDao;
import be.ipl.diapero.domaine.Action.Diablotin;
import be.ipl.diapero.domaine.Joueur;
import be.ipl.diapero.domaine.Partie;
import be.ipl.diapero.domaine.Tour;
import be.ipl.diapero.ucc.GestionJoueur;
import be.ipl.diapero.ucc.GestionTour;

public class TestGestionTour {

    private static GestionTour gp;	
    private Tour tour ;
	
	@Before
	public void setUp() throws Exception {
		try {
			Context jndi = new InitialContext();
			gp = (GestionTour) jndi
					.lookup("ejb:diaperoEAR/diapero/GestionTourImpl!be.ipl.diapero.ucc.GestionTour");
		} catch (NamingException e) {
			e.printStackTrace();
		}
		
		tour = new Tour(1);
	}

	
	@Test	
	public void testLancerDes(){
	    assertTrue(this.gp.lancerDes(tour));
	}
	
	@Test	
	public void testListerDes(){
	    assertNotNull(this.gp.listerDes(tour));
	}
	
	@Test	
	public void testPrendreDiablotin(){
	    assertFalse(this.gp.prendreDiablotin(new Partie("Partie1",new GregorianCalendar()), tour, new Joueur("Alain", "1234"), Diablotin.NOIR));
	}
	
	@Test	
	public void testRechercherTour(){
	    assertNotNull(this.gp.rechercherTour(new Partie("Partie1", new GregorianCalendar()), 0));
	}
	
	@Test	
	public void testRecupererActions(){
	    assertNotNull(this.gp.recupererActions(new Tour(0)));
	}
	
	@Test	
	public void testRecupererDeOrdre(){
	    assertNotNull(this.gp.recupererDeOrdre(new Tour(0)));
	}
	
}
